package Reflect;

import java.lang.reflect.Method;

public class ReflectDemo7 {
    public static void main(String[] args) throws Exception {
        Class cla=Class.forName("Reflect.Person");
        Object obj=cla.newInstance();

        Method method=cla.getDeclaredMethod("hehe");
        method.setAccessible(true);//打开权限
        method.invoke(obj);
        method.setAccessible(false);//关闭权限
    }
}
